import Decimal from 'decimal.js'
import { InferAttributes } from 'sequelize'
import { Column, DataType, Model, PrimaryKey, Table } from 'sequelize-typescript'

/**
 * 奖池表实例
 */
@Table({ tableName: 'jackpot', underscored: true, timestamps: false })
export class Jackpot extends Model<InferAttributes<Jackpot>> {
    @PrimaryKey
    @Column(DataType.BIGINT)
    declare id: number

    @Column({
        type: DataType.DECIMAL,
        get() {
            return new Decimal(this.getDataValue('balance') ?? 0)
        },
    })
    declare balance: Decimal
}
